Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

observe-resize

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

observe-resize

Trigger a callback when an element is resized

  • 1.1.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
14
increased by250%
Maintainers
1
Weekly downloads
 
Created
Source

observe-resize stability

npm version build status downloads js-standard-style

Trigger a callback when an element is resized. Adapted from simple-element-resize-detector.

Usage

var observeResize = require('observe-resize')
var html = require('bel')

var el = html`<div>hello planet</div>`
document.body.appendChild(el)

// observers should only be added _after_ the element is rendered on the DOM,
// else it displeases the browser emperors and they _will_ warn you
var stop = observeResize(el, function () {
  console.log('resized')
  stop()
})

API

stopObserving = observeResize(el, callback)

Observe resize events on the specified element. This event is throttled by requestAnimationFrame. In most cases you'd probably still want to use a debounce function to throttle changes, as resize events can be rather volatile otherwise.

stopObserving

Unbind the observer from the element.

Installation

$ npm install observe-resize

See Also

Similar Packages

License

MIT

Keywords

FAQs

Package last updated on 27 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc